﻿//submit
var SubmitVacation = function () {

    $('#operateButton').val('Submit');
    var uploadFile = encodeURI( $('[name="UploadFilePath"]').val().split('\\').pop() );

    if(requiredValidation($('.form_input_area'))){
        $.ajax({
            url:"/Vacation/Detail",
            type:"POST",
            data:$('form').serialize() + "&UploadFilePath=" + uploadFile,
            success:function(res){
                if(res == true){
                    alert('操作成功！');
                    RefreshParentAndCloseSelf();    
                }    
            }    
        });
    }
};

var approveReject = function(action){
    var applicationID = $('#applicationID').val(),
        operateNode = $('#operateNode').val(),
        CreatorID = $('#ProposerId').val();

    $.ajax({
        url: "/Vacation/Detail",
        type: "POST",
        data: "ApplicationID="+applicationID+"&operate=" + action + "&Node="+operateNode+"&CreatorID="+ CreatorID,
        success:function( res ){
            if(res == true){
                alert('操作成功！');
                RefreshParentAndCloseSelf();    
            }
        }    
    });    
};

//approve
var ApproveVacation = function(){
    
    approveReject( "Approve" );

};

var RejectVacation = function(){

    showModuleDialog("/Reject/Comment");
    //approveReject( "Reject" );
};